package appconfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type Mysql struct {
	User     string
	Password string
	Host     string
	Port     int
	Database string
}
type Redis struct {
	Host     string
	Port     int
	Password string
}
type Appconfig struct {
	Mysql
	Redis
}

var Config Appconfig

func Init() {
	viper.SetConfigFile("../appconfig/dev.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		fmt.Println("读取配置文件失败")
		return
	} else {
		fmt.Println("读取配置文件成功")
	}
	viper.Unmarshal(&Config)
}
